#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
# @FileName  :schemas.py
# @Time      :2022/8/12 01:34
# @Author    :Toliong toliong@foxmail.com
"""
from pydantic import BaseModel


class ItemBase(BaseModel):
    title: str
    description: str | None = None


class ItemCreate(ItemBase):
    # 继承的类名 要注意，别写错了
    pass


class Item(ItemBase):
    id: int
    owner_id: int

    class Config:
        orm_mode = True


class UserBase(BaseModel):
    email: str


class UserCreate(UserBase):
    password: str


class User(UserBase):
    id: int
    is_active: bool
    items: list[Item] = []

    class Config:
        orm_mode = True

